package test;

import org.xmap.ui.View;
import org.xmap.ui.ViewManager;
import org.xmap.ui.base.Window;
import org.xmap.ui.views.TextAreaView;

public class MessageBoxView extends TextAreaView {

    public MessageBoxView(View back) {
        super(back);
//        this.setBgColor(0xffffff88);
        this.addText("这是个消息框控件演示，选择“随机文本颜色”菜单设置消息框的文本颜色为随机颜色，选择“随机边框颜色”设置消息框的边框颜色为随机颜色，选择“边框模式”菜单下的子菜单可以显示或隐藏边框，选择“消息框模式”菜单下的子菜单可以弹出单行或双行的提示信息。");
        this.setTitleText("消息框控件演示");
        this.addLeftMenu("随机文本颜色");
//        this.addLeftMenu("随机高亮颜色");
        this.addLeftMenu("随机边框颜色");
        this.addLeftMenu("边框模式", new String[]{"边框显示", "边框隐藏"});
        this.addLeftMenu("消息框模式", new String[]{"单行提示", "双行提示" /*, "模式三", "模式四", "模式五"*/});
        this.setRightMenu("返回");
    }

    public void update() {
//        this.msgBox.setTextColor((int) System.currentTimeMillis());
    }

    public void commandEvent(String command, Window sender) {
        if (command.equals("随机文本颜色")) {
//            this.getMsgBox().setTextColor(XmapDemo.getRandomColor());
//        } else if (command.equals("随机高亮颜色")) {
//            this.msgBox.setHightLightColor(TestXmap.getRandomColor());
        } else if (command.equals("随机边框颜色")) {
//            this.getMsgBox().setLineColor(XmapDemo.getRandomColor());
        } else if (command.equals("边框显示")) {
//            this.getMsgBox().setDrawRect(true);
        } else if (command.equals("边框隐藏")) {
//            this.getMsgBox().setDrawRect(false);
        } else if (command.equals("单行提示")) {
            this.msgBox("确认", "返回", "单行的提示信息");
        } else if (command.equals("双行提示")) {
            this.msgBox("确认", "返回", "第一行提示信息", null, "第二行提示信息", null);
//        } else if (command.equals("模式三")) {
//            this.msgBox("确认", "返回", "文字一", "高亮一", "文字二", null);
//        } else if (command.equals("模式四")) {
//            this.msgBox("确认", "返回", "文字一", "文字二");
//        } else if (command.equals("模式五")) {
//            this.msgBox("确认", "返回", "唯一的一行文字");
//        } else if (command.equals("返回") && sender == this.getMenubar()) {
//            ViewManager.instance.setView(this.back, View.ANIMATION_LEFT_TO_RIGHT);
        }
    }
}
